package com.heima.user.controllerv1;

import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.user.dtos.UserRelationDto;
import com.heima.user.service.ApUserFollowService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/v1/user")
public class ApUserFollowController{

    @Autowired
    private ApUserFollowService apUserFollowService;

    @PostMapping("/user_follow")
    public ResponseResult follow(@RequestBody UserRelationDto dto){
        return apUserFollowService.follow(dto);
    }

    @PostMapping("/isFollow")
    public boolean isFollow(@RequestParam("authorId") Integer authorId,@RequestParam(value = "userId",required = false) Integer userId){
        return apUserFollowService.isFollow(authorId,userId);
    }
}
